package com.zjol

import scala.io.Source


/**
  * Created by Administrator on 2017/3/27.
  */
object tupleDemo {


  def tupleDemo = {
    var pair = (10, 23, "234")
    println(pair._1)
    println(pair._2)
    println(pair._3)
  }

  def arrayDemo = {
    val array = Array(1, 2, 3, 4)
    for (i <- array) {
      println(i)
    }
  }
  def  mapDemo={
    val user=Map("zhaochao"->20,"xiaoming"->45)
    for ((k,v)<-user){
      println(k+"-->"+v)
    }
  }

  def  fileDemo={
     var file=Source.fromURL("http://www.baidu.com")
    for (line<-file.getLines()){
      println(line)
    }
  }


  def main(args: Array[String]): Unit = {

    tupleDemo
    arrayDemo
    mapDemo
    fileDemo


  }

}
